package collectionexercise;

import collection.Point;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;

public class CollectionDemo {
    public static void main(String[] args) {
        Collection c1 = new ArrayList();
        c1.add("one");
        c1.add("two");
        c1.add("three");
        c1.add("four");
        c1.add("five");
        System.out.println(c1);

        System.out.println(c1.isEmpty());//
        String s = "one";
        System.out.println(c1.contains(s));//t
        c1.add("one");
        System.out.println(c1);
        c1.clear();
        System.out.println(c1.isEmpty());//t



        Collection c2 = new HashSet();
        c2.add("one");
        c2.add("two");
        c2.add("three");
        c2.add("four");
        c2.add("five");
        System.out.println(c2);
        c2.add("two");
        System.out.println(c2);

        Collection c3 =new ArrayList();
        c3.add(new collection.Point(1,2));
        c3.add(new collection.Point(3,4));
        c3.add(new collection.Point(5,6));
        c3.add(new collection.Point(7,8));
        c3.add(new collection.Point(9,0));
        c3.add(new Point(1,2));
        System.out.println(c3);
        Point p = new Point(1,2);
        System.out.println(c3.contains(p));

        c3.remove(p);
        c3.remove(p);
        System.out.println(c3);




    }
}
